package com.yuke.cloud.service.cmc.controller.frontend;

import com.yuke.cloud.common.core.support.BaseController;
import com.yuke.cloud.common.util.wrapper.WrapMapper;
import com.yuke.cloud.common.util.wrapper.Wrapper;
import com.yuke.cloud.service.cmc.entity.CmsAppVer;
import com.yuke.cloud.service.cmc.service.CmsAppVerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/*
 * <p>Company: Copyright (c) 2018. yuke All Rights Reserved. </br> </p>
 * <p>Title：yukemall </br> </p>
 * <p>com.yuke.cloud.service.cmc.controller.frontend Description TODO </br> </p>
 * @Author wg
 * @Date   2019/7/23 10:36
 */
@Api(value = "WEB - MallCmsPromoteController", tags = "APP版本相关请求", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@RestController
@RequestMapping("/mall/cms/app_ver")
public class MallCmsAppVerController extends BaseController {
    @Resource
    private CmsAppVerService cmsAppVerService;

    @GetMapping("/getNewVerInfo")
    @ApiOperation(httpMethod = "GET", value = "获取APP最新版本信息")
    public Wrapper<CmsAppVer> getFirstOrderPromote(@ApiParam(name = "appType", value = "APP类型") @RequestParam Byte appType,
                                                   @ApiParam(name = "appProject", value = "APP类型") @RequestParam(defaultValue = "0") Byte appProject
    ) {

        CmsAppVer cmsAppVer = cmsAppVerService.getNewVerInfo(appType,appProject);
        return WrapMapper.ok(cmsAppVer);
    }
}
